export default class local {
  static set(key, value) {
    localStorage.setItem(key, JSON.stringify(value))
  }
  static get(key) {
    var d = localStorage.getItem(key)
    if (!d || d == 'undefined') return d
    return JSON.parse(d)
  }

  static remove(key) {
    localStorage.removeItem(key)
  }

  static clear() {
    localStorage.clear()
  }
  // 如果设置为length，转为js时会报错
  static count() {
    return localStorage.length
  }
}
